<!DOCTYPE HTML>
<html lang="zh-tw" >
    <!-- Start book reacjs开发 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>组件更新机制及性能优化 | reacjs开发</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-emphasize/plugin.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
    

        
    
    
    <link rel="next" href="../004day/section10.html" />
    
    
    <link rel="prev" href="../004day/section08.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="4.9"
        data-chapter-title="组件更新机制及性能优化"
        data-filepath="004day/section09.md"
        data-basepath=".."
        data-revision="Sun Feb 16 2020 11:31:01 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        课程介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="001day/index.html">
            
                
                    <a href="../001day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        react入门
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="001day/section01.html">
            
                
                    <a href="../001day/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        react介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="001day/section02.html">
            
                
                    <a href="../001day/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        快速开始
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="001day/section03.html">
            
                
                    <a href="../001day/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        JSX语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="001day/section04.html">
            
                
                    <a href="../001day/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        函数组件和参数props
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="001day/section05.html">
            
                
                    <a href="../001day/section05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        ES6语法之类和类的继承
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="001day/section06.html">
            
                
                    <a href="../001day/section06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        类组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="001day/section07.html">
            
                
                    <a href="../001day/section07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        绑定事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="001day/section08.html">
            
                
                    <a href="../001day/section08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        状态(state)
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="002day/index.html">
            
                
                    <a href="../002day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        react进阶
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="002day/section01.html">
            
                
                    <a href="../002day/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        新增数组方法、属性表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="002day/section02.html">
            
                
                    <a href="../002day/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        列表渲染
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="002day/section03.html">
            
                
                    <a href="../002day/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        条件渲染
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="002day/section04.html">
            
                
                    <a href="../002day/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        表单数据绑定
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="002day/section05.html">
            
                
                    <a href="../002day/section05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        Refs操作元素，文件上传
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="002day/section06.html">
            
                
                    <a href="../002day/section06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        生命周期方法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="003day/index.html">
            
                
                    <a href="../003day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        脚手架开发
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="003day/section01.html">
            
                
                    <a href="../003day/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        yarn的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="003day/section02.html">
            
                
                    <a href="../003day/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        脚手架开发
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="004day/index.html">
            
                
                    <a href="../004day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        react高级
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="004day/section01.html">
            
                
                    <a href="../004day/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        js模块化开发
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="004day/section02.html">
            
                
                    <a href="../004day/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        数据传递
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="004day/section03.html">
            
                
                    <a href="../004day/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        拆分组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="004day/section04.html">
            
                
                    <a href="../004day/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        组件children属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="004day/section05.html">
            
                
                    <a href="../004day/section05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        props校验
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="004day/section06.html">
            
                
                    <a href="../004day/section06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        props默认值
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="004day/section07.html">
            
                
                    <a href="../004day/section07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        render-props模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="004day/section08.html">
            
                
                    <a href="../004day/section08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        高阶组件(HOC)
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="4.9" data-path="004day/section09.html">
            
                
                    <a href="../004day/section09.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        组件更新机制及性能优化
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="004day/section10.html">
            
                
                    <a href="../004day/section10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.10.</b>
                        
                        虚拟dom及diff算法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="005day/index.html">
            
                
                    <a href="../005day/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        react深入
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="005day/section01.html">
            
                
                    <a href="../005day/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        react路由
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="005day/section02.html">
            
                
                    <a href="../005day/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        redux
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="005day/section03.html">
            
                
                    <a href="../005day/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        react-redux
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本書使用 GitBook 釋出
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >reacjs开发</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h2 id="&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x673A;&#x5236;&#x53CA;&#x6027;&#x80FD;&#x4F18;&#x5316;">&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x673A;&#x5236;&#x53CA;&#x6027;&#x80FD;&#x4F18;&#x5316;</h2>
<p>react&#x7EC4;&#x4EF6;&#x7684;&#x66F4;&#x65B0;&#x673A;&#x5236;&#x662F;&#xFF0C;&#x5982;&#x679C;&#x5F53;&#x524D;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E86;&#xFF0C;&#x90A3;&#x4E48;&#x5F53;&#x524D;&#x7EC4;&#x4EF6;&#x7684;&#x5B50;&#x7EC4;&#x4EF6;&#x4E5F;&#x4F1A;&#x8DDF;&#x7740;&#x4E00;&#x8D77;&#x66F4;&#x65B0;&#xFF0C;&#x5373;&#x4F7F;&#x5B50;&#x7EC4;&#x4EF6;&#x4E2D;&#x6CA1;&#x6709;&#x66F4;&#x65B0;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x8FD9;&#x5C31;&#x662F;react&#x7EC4;&#x4EF6;&#x7684;&#x66F4;&#x65B0;&#x673A;&#x5236;&#x3002;</p>
<p><img src="images/fresh.png" alt="&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x673A;&#x5236;">  </p>
<h4 id="&#x5B9E;&#x4F8B;&#x6F14;&#x793A;">&#x5B9E;&#x4F8B;&#x6F14;&#x793A;</h4>
<pre><code>class Son extends Component {
    render() {
        console.log(&apos;&#x5B50;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E86;&#xFF01;&apos;);
        return (
            &lt;div&gt;
                &lt;p&gt;&#x6211;&#x662F;&#x5B50;&#x7EC4;&#x4EF6;&lt;/p&gt;
            &lt;/div&gt;
        );
    }
}

class Father extends Component {
    constructor(props){
        super(props);
        this.state = {
           iNum:10
        }
    }

    fnAdd=()=&gt;{
        this.setState(state=&gt;({iNum:state.iNum+1}))
    }

    render() {
        console.log(&apos;&#x7236;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E86;&#xFF01;&apos;);
        return (
            &lt;div&gt;
                &lt;p&gt;&#x6211;&#x662F;&#x7236;&#x7EC4;&#x4EF6;&lt;/p&gt;
                &lt;p&gt;{ this.state.iNum }&lt;/p&gt;
                &lt;input type=&quot;button&quot; value=&quot; +1 &quot; onClick={ this.fnAdd } /&gt;
                &lt;Son /&gt;
            &lt;/div&gt;
        );
    }
}
</code></pre><p>&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#xFF0C;&#x7236;&#x7EC4;&#x4EF6;&#x5728;&#x66F4;&#x65B0;&#x6570;&#x636E;&#xFF0C;&#x5B50;&#x7EC4;&#x4EF6;&#x4E5F;&#x4F1A;&#x8DDF;&#x7740;&#x4E00;&#x8D77;&#x66F4;&#x65B0;&#xFF0C;&#x5176;&#x5B9E;&#x8FD9;&#x662F;&#x6CA1;&#x6709;&#x5FC5;&#x8981;&#x7684;&#xFF0C;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7EAF;&#x7EC4;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#x6765;&#x907F;&#x514D;&#x8FD9;&#x79CD;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x7EAF;&#x7EC4;&#x4EF6;&#x7684;&#x521B;&#x5EFA;&#x65B9;&#x5F0F;&#x662F;&#xFF0C;&#x8BA9;&#x7C7B;&#x7EC4;&#x4EF6;&#x7EE7;&#x627F;&#x4E8E; React.PureComponent&#x3002;</p>
<pre><code>// &#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7EAF;&#x7EC4;&#x4EF6;
class Son extends React.PureComponent {
    render() {
......
</code></pre><p>&#x6709;&#x65F6;&#x5019;&#xFF0C;&#x7236;&#x7EC4;&#x4EF6;&#x9700;&#x8981;&#x5411;&#x5B50;&#x7EC4;&#x4EF6;&#x4F20;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x4F20;&#x503C;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6709;&#x4E9B;&#x65F6;&#x5019;&#x662F;&#x4F20;&#x9012;&#x76F8;&#x540C;&#x7684;&#x503C;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#xFF0C;&#x5B50;&#x7EC4;&#x4EF6;&#x5C31;&#x6CA1;&#x5FC5;&#x8981;&#x66F4;&#x65B0;&#x4E86;&#xFF0C;&#x5728;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7EAF;&#x7EC4;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x5982;&#x679C;&#x4E0D;&#x4F7F;&#x7528;&#x7EAF;&#x7EC4;&#x4EF6;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x751F;&#x547D;&#x5468;&#x671F;&#x51FD;&#x6570;shouldComponentUpdate&#xFF0C;&#x5728;&#x751F;&#x547D;&#x5468;&#x671F;&#x51FD;&#x6570;&#x4E2D;&#x6765;&#x5224;&#x65AD;&#x4E24;&#x4E2A;&#x503C;&#x662F;&#x5426;&#x76F8;&#x540C;&#xFF0C;&#x5982;&#x679C;&#x4E0D;&#x540C;&#xFF0C;&#x5C31;&#x8FD4;&#x56DE;true&#xFF0C;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#xFF0C;&#x5982;&#x679C;&#x76F8;&#x540C;&#xFF0C;&#x5C31;&#x8FD4;&#x56DE;false&#xFF0C;&#x7EC4;&#x4EF6;&#x5C31;&#x4E0D;&#x66F4;&#x65B0;&#x4E86;&#x3002;</p>
<pre><code>class Son extends Component {
    // &#x5728;&#x751F;&#x547D;&#x5468;&#x671F;&#x51FD;&#x6570;&#x4E2D;&#x505A;&#x5224;&#x65AD;
    // nextProps&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x5F97;&#x5230;props&#x6700;&#x65B0;&#x7684;&#x503C;&#xFF0C;&#x800C;this.props&#x53EF;&#x4EE5;&#x5F97;&#x5230;props&#x4E4B;&#x524D;&#x7684;&#x503C;
    shouldComponentUpdate(nextProps){
        //console.log(this.props.iNum, nextProps.iNum);
        return this.props.iNum !== nextProps.iNum
    }

    render() {     
        console.log(&apos;&#x5B50;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E86;&#xFF01;&apos;);
        return (
            &lt;div&gt;
                &lt;p&gt;&#x6211;&#x662F;&#x5B50;&#x7EC4;&#x4EF6;&lt;/p&gt;
                &lt;p&gt;&#x5B50;&#x7EC4;&#x4EF6;&#x663E;&#x793A;&#x7236;&#x7EC4;&#x4EF6;&#x6570;&#x636E;&#xFF1A;{ this.props.iNum }&lt;/p&gt;
            &lt;/div&gt;
        );
    }
}

class Father extends Component {
    constructor(props){
        super(props);
        this.state = {
          iNum:0
        }
    }

    fnAdd=()=&gt;{
        this.setState({
            iNum: Math.floor(Math.random()*2)
        })
    }

    render() {
        console.log(this.state.iNum);
        console.log(&apos;&#x7236;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E86;&#xFF01;&apos;);
        return (
            &lt;div&gt;
                &lt;p&gt;&#x6211;&#x662F;&#x7236;&#x7EC4;&#x4EF6;&lt;/p&gt;
                &lt;input type=&quot;button&quot; value=&quot; +1 &quot; onClick={ this.fnAdd } /&gt;
                &lt;Son iNum={ this.state.iNum } /&gt;
            &lt;/div&gt;
        );
    }
}
</code></pre><p>&#x4E0D;&#x662F;&#x4EC0;&#x4E48;&#x65F6;&#x5019;&#x90FD;&#x8981;&#x7528;&#x7EAF;&#x7EC4;&#x4EF6;&#xFF0C;&#x56E0;&#x4E3A;&#x7EAF;&#x7EC4;&#x4EF6;&#x5728;&#x5185;&#x90E8;&#x4F1A;&#x505A;&#x66F4;&#x65B0;&#x7684;&#x5224;&#x65AD;&#xFF0C;&#x6240;&#x4EE5;&#x5B83;&#x7684;&#x6027;&#x80FD;&#x4F1A;&#x6BD4;&#x4E00;&#x822C;&#x7EC4;&#x4EF6;&#x4F4E;&#xFF0C;&#x5982;&#x679C;&#x7236;&#x7EC4;&#x4EF6;&#x4E0D;&#x66F4;&#x65B0;&#xFF0C;&#x5B50;&#x7EC4;&#x4EF6;&#x81EA;&#x5DF1;&#x66F4;&#x65B0;&#x6570;&#x636E;&#xFF0C;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x5C31;&#x6CA1;&#x5FC5;&#x8981;&#x7528;&#x7EAF;&#x7EC4;&#x4EF6;&#x3002;</p>
<h4 id="&#x7EC4;&#x4EF6;&#x6027;&#x80FD;&#x4F18;&#x5316;">&#x7EC4;&#x4EF6;&#x6027;&#x80FD;&#x4F18;&#x5316;</h4>
<p>1&#x3001;&#x5C3D;&#x91CF;&#x51CF;&#x5C11;state&#x4E2D;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x53D8;&#x91CF;&#x53EF;&#x4EE5;&#x5B58;&#x50A8;&#x5728;this&#x4E2D;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x76F4;&#x63A5;&#x7ED1;&#x5B9A;&#x5728;&#x7EC4;&#x4EF6;&#x4E0A;&#xFF0C;&#x800C;&#x4E0D;&#x653E;&#x5230;&#x7EC4;&#x4EF6;&#x7684;state&#x4E2D;&#xFF0C;&#x6BD4;&#x5982;&#x521B;&#x5EFA;&#x5B9A;&#x65F6;&#x5668;&#x8FD4;&#x56DE;&#x7684;id&#x503C;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x5B83;&#x653E;&#x5230;&#x7EC4;&#x4EF6;this&#x4E2D;&#x3002;</p>
<p>2&#x3001;&#x51CF;&#x5C11;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;PureComponent&#x7EAF;&#x7EC4;&#x4EF6;&#x6216;&#x8005;shouldComponentUpdate&#x6765;&#x5E2E;&#x6211;&#x4EEC;&#x907F;&#x514D;&#x5B50;&#x7EC4;&#x4EF6;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x66F4;&#x65B0;&#x3002;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../004day/section08.html" class="navigation navigation-prev " aria-label="Previous page: 高阶组件(HOC)"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../004day/section10.html" class="navigation navigation-next " aria-label="Next page: 虚拟dom及diff算法"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/fontsettings.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"fontsettings":{"family":"sans","size":2,"theme":"white"},"toggle-chapters":{},"splitter":{},"emphasize":{},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book reacjs开发 -->
</html>
